#include "robotLac.h"
#include "Servo.h"

robotLac robot(28,1);
Color_Sensor ColorSensor(27, 25, 24, 26,22);
int R, G, B;

void setup(){
  pinMode(23,OUTPUT);
  ColorSensor.begin();
  digitalWrite(23, LOW);
  robot.begin();
}

void loop(){
  ColorSensor.calc_RGB();
  R = ColorSensor.get_R();
  G = ColorSensor.get_G();
  B = ColorSensor.get_B();
  if(R<50 & G<50 & B<50){
     robot.retroceder();
    delay(300);
    robot.horario();
    delay(600);
  }
  else{
    robot.avanzar();
    delay(10);
  }
}
